|
accurrent2 2.2.1
|
API for configuring and manipulating AC Current 2 Click driver. More...
Topics | |
| AC Current 2 Settings | |
| Settings of AC Current 2 Click driver. | |
| AC Current 2 MikroBUS Map | |
| MikroBUS pin mapping of AC Current 2 Click driver. | |
Functions | |
| void | accurrent2_cfg_setup (accurrent2_cfg_t *cfg) |
| AC Current 2 configuration object setup function. | |
| void | accurrent2_drv_interface_sel (accurrent2_cfg_t *cfg, accurrent2_drv_t drv_sel) |
| AC Current 2 driver interface setup function. | |
| err_t | accurrent2_init (accurrent2_t *ctx, accurrent2_cfg_t *cfg) |
| AC Current 2 initialization function. | |
| err_t | accurrent2_read_raw_adc (accurrent2_t *ctx, uint16_t *raw_adc) |
| AC Current 2 read raw ADC value function. | |
| err_t | accurrent2_read_voltage (accurrent2_t *ctx, float *voltage) |
| AC Current 2 read voltage level function. | |
| err_t | accurrent2_read_voltage_avg (accurrent2_t *ctx, uint16_t num_conv, float *voltage_avg) |
| AC Current 2 read average voltage level function. | |
| err_t | accurrent2_set_vref (accurrent2_t *ctx, float vref) |
| AC Current 2 set vref function. | |
| err_t | accurrent2_read_current (accurrent2_t *ctx, float *current) |
| AC Current 2 read current function. | |
API for configuring and manipulating AC Current 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void accurrent2_cfg_setup | ( | accurrent2_cfg_t * | cfg | ) |
AC Current 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See accurrent2_cfg_t object definition for detailed explanation. |
| void accurrent2_drv_interface_sel | ( | accurrent2_cfg_t * | cfg, |
| accurrent2_drv_t | drv_sel ) |
AC Current 2 driver interface setup function.
This function sets a serial driver interface which will be used further in the Click driver.
| [out] | cfg | : Click configuration structure. See accurrent2_cfg_t object definition for detailed explanation. |
| [in] | drv_sel | : Driver interface selection. See accurrent2_drv_t object definition for detailed explanation. |
| err_t accurrent2_init | ( | accurrent2_t * | ctx, |
| accurrent2_cfg_t * | cfg ) |
AC Current 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See accurrent2_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t accurrent2_read_current | ( | accurrent2_t * | ctx, |
| float * | current ) |
AC Current 2 read current function.
This function reads the current measurement from the AC Current sensor (30A/1V).
| [in] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [out] | current | : Pointer to store the measured current value in Amperes. |
0 - Success, -1 - Error. | err_t accurrent2_read_raw_adc | ( | accurrent2_t * | ctx, |
| uint16_t * | raw_adc ) |
AC Current 2 read raw ADC value function.
This function reads raw ADC value.
| [in] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [out] | raw_adc | : Output ADC result. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t accurrent2_read_voltage | ( | accurrent2_t * | ctx, |
| float * | voltage ) |
AC Current 2 read voltage level function.
This function reads raw ADC value and converts it to proportional voltage level.
| [in] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [out] | voltage | : Output voltage level [V]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t accurrent2_read_voltage_avg | ( | accurrent2_t * | ctx, |
| uint16_t | num_conv, | ||
| float * | voltage_avg ) |
AC Current 2 read average voltage level function.
This function reads a desired number of ADC samples and calculates the average voltage level.
| [in] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [in] | num_conv | : Number of ADC samples. |
| [out] | voltage_avg | : Average output voltage level [V]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t accurrent2_set_vref | ( | accurrent2_t * | ctx, |
| float | vref ) |
AC Current 2 set vref function.
This function sets the voltage reference for AC Current 2 Click driver.
| [in] | ctx | : Click context object. See accurrent2_t object definition for detailed explanation. |
| [in] | vref | : Reference voltage (volts). |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.